/*********************************************************************************
Organization 					: 				Georgia Institute of Technology
  
Institute 						:				Cognitive Computing Group(CCL)
 
Authors							: 				Santiago Ontanon
 												
Class							:				StatusSoftCondition
 
Function						: 				Provides a class for holding a status 
												condition 
****************************************************************************/

package planninglanguage.softconditions;

import base.WargusGameState;
import base.WargusStateImporter;
import base.WargusUnit;

public class StatusSoftCondition extends SoftCondition {
	int m_unitID;
	String m_status;
	
	public StatusSoftCondition(int a_unitID,String a_status)
	{
		m_unitID = a_unitID;
		m_status = a_status;
	}
	public String toString(int tabs)
	{
		String n = super.toString(tabs);
		n = n + "Unit Id is: " + m_unitID;
		n = n + "Status is: " + m_status;
		return n;
	}
	public float test(WargusGameState a_gameState)
	{
//		System.out.println("StatusCondition: test( unitID = " + m_unitID + " status = " + m_status + ")");
		
		WargusUnit u = a_gameState.getUnit(m_unitID);
		
		if (u != null) {
			if (WargusStateImporter.statusToString(u.getStatus()[0]).equals(m_status))
				return 1.0f;
		}
		return 0.0f;
	}
}
